#!/usr/bin/env python3

import random


def select_order(nums):
    for i in range(len(nums) - 1):
        minIndex = i
        for j in range(i + 1, len(nums)):
            if nums[j] < nums[minIndex]:
                minIndex = j
        if minIndex != i:
            nums[i], nums[minIndex] = nums[minIndex], nums[i]

    return nums


def insert_order(nums):
    for i in range(len(nums)):
        prefix = i - 1
        current = nums[i]
        while prefix >= 0 and nums[prefix] > current:
            nums[prefix + 1] = nums[prefix]
            prefix -= 1
        nums[prefix + 1] = current

    return nums


if __name__ == "__main__":
    nums = [random.randint(0, 10) for i in range(10)]
    print("before: %s" % nums)
    nums = insert_order(nums)
    print("after: %s" % nums)
